Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new stellar contract info hash subcommand to retrieve a contract Wasm SHA-256 hash either by hashing a local .wasm file or by reading the ContractExecutable::Wasm(hash) from a deployed contract instance via RPC (without downloading the full Wasm).
Changes:
- Introduces
stellar contract info hashCLI subcommand (with mutually exclusive--wasmand--contract-id/--idsources). - Adds an RPC helper to read a deployed contract’s Wasm hash from the contract instance ledger entry.
- Adds integration tests covering local file hashing, deployed contract ID, alias resolution, and basic argument validation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| FULL_HELP_DOCS.md | Documents the new stellar contract info hash subcommand. |
| cmd/soroban-cli/src/wasm.rs | Adds helper to fetch Wasm hash from a deployed contract’s instance entry. |
| cmd/soroban-cli/src/commands/contract/info/hash.rs | Implements the new contract info hash command and argument parsing. |
| cmd/soroban-cli/src/commands/contract/info.rs | Wires the new hash subcommand into contract info. |
| cmd/crates/soroban-test/tests/it/integration/contract/mod.rs | Registers the new integration test module. |
| cmd/crates/soroban-test/tests/it/integration/contract/info_hash.rs | Adds integration tests for contract info hash. |
leighmcculloch
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add a new
stellar contract info hashsubcommand that outputs the SHA-256 hash of a contract's Wasm. The source can be a local.wasmfile or a deployed contract ID/alias on a network. The two flags are mutually exclusive:The hash is printed as a hex string to stdout so it can be captured into shell variables.
Why
Closes #1877. Retrieving the Wasm hash of a deployed contract previously required either chaining
curl,jq, andstellar xdr decode, or scraping informational stderr logs from unrelated commands — neither convenient for scripting.For the
--idpath the implementation readsContractExecutable::Wasm(hash)directly from the contract instance ledger entry rather than downloading the full Wasm blob, so it's a single RPC round trip with a small payload.Known limitations
A Stellar Asset Contract has no Wasm and therefore no hash; using
--idagainst a SAC errors out.